#coding=utf-8

module Aio::Module
	class Description

		attr_accessor :description_info

		def initialize(info={})
			@description_info = info.dup
			set_defaults()
		end

		def set_defaults
			self.description_info = {
				:author			=> nil,
				:case 			=> nil,
				:name				=> nil,
				:title			=> nil,
				:description	=> nil,
				:license			=> ::Aio::AIO_LICENSE,
			}.update(@description_info)
		end

		def type
			Aio::Module::Description
		end

		# 重载方法
		def to_s
			"暂无描述信息。"
		end

		# 判断是否是 Description 父类
		def parent?
			self.class == type ? true : false
		end

		# 创建临时信息,用于在没有描述类的时候使用
		def temp(cs)
			clear
			@description_info[:case] = cs
			@description_info[:name] = cs.to_s.upcase
			@description_info[:title] = cs.to_s.upcase + "检查"
			self
		end

		# 清楚基本信息
		def clear
			self.description_info = {
				:author			=> nil,
				:case 			=> nil,
				:name				=> nil,
				:title			=> nil,
				:description	=> nil,
				:license			=> ::Aio::AIO_LICENSE,
			}
		end

		def author;			description_info[:author];	end
		def case;				description_info[:case];		end
		def name;				description_info[:name];		end
		def title;			description_info[:title];		end
		def description;	description_info[:description];		end
		def license;		description_info[:license];	end

	end
end
